package jdwl.hrmgrsys.service;

import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;

import javax.annotation.Resource;

import jdwl.hrmgrsys.dao.enterprise.EnterpriseParamDao;
import jdwl.hrmgrsys.pojo.core.CommonPara;
import jdwl.hrmgrsys.pojo.core.ParaType;

import org.hibernate.property.Getter;
import org.springframework.stereotype.Service;

import com.ssh.core.QueryResult;
import com.ssh.service.CRUDService;
@Service
public class EnterpriseParamService  extends CRUDService<CommonPara> {
	@Resource
	private EnterpriseParamDao dao;
	
	public QueryResult<CommonPara> listCommonParas(int pageNo,int pageSize,List<String> whereClause,LinkedHashMap<String, String> paramMap, LinkedHashMap<String, String> orderbyClause) {
		return getDao().findScrollData(CommonPara.class,pageNo, pageSize,whereClause,paramMap,orderbyClause);
	}
	public List<CommonPara> queryCommonParas(String propertyName, Object value) {
		return getDao().findByProperty(CommonPara.class, propertyName, value);
	}
	public List<CommonPara> queryCommonParasByType(String typeCode) {
		return getDao().queryCommonParasByType(typeCode);
	}
	
	public List<ParaType> queryParaTypes(){
		List<ParaType> types = getDao().findAll(ParaType.class);
		return types;
	}
	public EnterpriseParamDao getDao() {
		return dao;
	}
	public void setDao(EnterpriseParamDao dao) {
		this.dao = dao;
	}
	public void addParam(CommonPara param) {
		dao.getHibernateTemplate().saveOrUpdate(param);
	}
}
